package util;

public class Nifty {

    /**
     * Cleans comments (denoted by '//') from a String
     *
     * @param s The String to have comments cleaned from
     *
     * @return Returns the String that has been cleaned of comments
     */
    public static String cleanComments(String s, String token) {
        if (!s.contains(token)) {
            return s;
        }
        else {
            int index = s.indexOf(token);
            return s.substring(0, index);
        }
    }
    
    public static String directoryFrom(String filePath) {
        int slashIndex = filePath.lastIndexOf("\\");
        return filePath.substring(0, slashIndex);
    }

}
